package com.ming.attendance.mapper;

import com.ming.attendance.po.WxGroup;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface WxGroupMapper {
    // 获取opengid列表，一个人可以在多个群里
    @Select("SELECT opengid FROM wx_group WHERE openid = #{openid}")
    List<String> getOpengids(String openid);

    // 获取openid列表，一个群可以有多个微信用户
    @Select("SELECT openid FROM wx_group WHERE opengid = #{opengid};")
    List<String> getOpenids(String opengid);

    // 添加微信群组用户对应表
    @Insert("INSERT INTO wx_group VALUES (#{openid},#{opengid})")
    int saveGroup(WxGroup group);

}
